package cn.wb.base.config;

import cn.wb.base.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 登录配置
 */
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor interceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor)
                .addPathPatterns("/**") // 拦截路径
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/shop/settlement/**")
                .excludePathPatterns("/shop/activity/**")
                .excludePathPatterns("/fastdfs/**")
                .excludePathPatterns("/verifyCode/**");
    }
}
